pretemp = pre ;
pre     = pre*36 ;


format shortg
disp('*****************************************************************************************')
disp('*****************************************************************************************')
disp('****************    INITIAL PROFICIENCY PRODUCTION FUNCTION (RF):   *********************')
disp('*****************************************************************************************')
disp('*****************************************************************************************')

logPreScore = log(pre) ;  
StDevlogPre = std(logPreScore) ;

%%
% NHelpers    = AchievementData.helpadult + AchievementData.helppeer ; NHelpers = NHelpers(useindx) ;
% NHelppeer   = AchievementData.helppeer ;  NHelppeer  = NHelppeer(useindx) ;
% NHelpadult  = AchievementData.helpadult ; NHelpadult = NHelpadult(useindx) ;
% Helperuseindx = find(~isnan(NHelpers)) ;
NHelpers    = X_E(:,4) + X_E(:,5) ; NHelpers = NHelpers(useindx) ; 
NHelppeer   = X_E(:,5) ; NHelppeer  = NHelppeer(useindx) ; 
NHelpadult  = X_E(:,4) ; NHelpadult = NHelpadult(useindx) ; 
InvPar      = X_E(:,15) ;
BigFam      = X_E(:,16) ;
Middle      = X_E(:,17) ;
Youngest    = X_E(:,18) ;
NoHmIntrnt  = X_E(:,12) ; 
MoblFrac    = X_E(:,13) ; 
TabltFrac   = X_E(:,14) ;


labels_LR5  = {'Constant';'log(thetaE)';'log(thetaL)';'D2';'D3';'D2*log(thetaE)';'D3*log(thetaE)';'D2*log(thetaL)';'D3*log(thetaL)';...
               'grade5';'grade5*log(thetaE)';'grade5*log(thetaL)'; 'fem'; 'fem*log(thetaE)'; 'fem*log(thetaL)';...
               'black';'hispanic';'log(thetaE)*blk';'log(thetaE)*hsp';'log(thetaL)*blk';'log(thetaL)*hsp';...
               'SSEInc';'SSEIns';'log(thetaE)*SSEInc';'log(thetaE)*SSEIns';'log(thetaL)*SSEInc';'log(thetaL)*SSEIns';...
               'NHelpers';'log(thetaE)*NHelpers';'log(thetaL)*NHelpers';'InvPar';'BigFam';'Middle';'Youngest';...
               'log(thetaE)*InvPar';'log(thetaE)*BigFam';'log(thetaE)*Middle';'log(thetaE)*Youngest';...
               'log(thetaL)*InvPar';'log(thetaL)*BigFam';'log(thetaL)*Middle';'log(thetaL)*Youngest';...
               'NoHmIntrnt';'log(thetaE)*NoHmIntrnt';'log(thetaL)*NoHmIntrnt';...
               'MoblFrac';'log(thetaE)*MoblFrac';'log(thetaL)*MoblFrac';...
               'TabltFrac';'log(thetaE)*TabltFrac';'log(thetaL)*TabltFrac'} ;
ExpVars_LR5 = [ones(size(logPreScore)), ...1
               log(Y_EimputeShrunk), ...2
               log(Y_LimputeShrunk), ...3
               D2, ...4
               D3, ...5
               log(Y_EimputeShrunk).*D2, ...6
               log(Y_EimputeShrunk).*D3, ...7
               log(Y_LimputeShrunk).*D2, ...8
               log(Y_LimputeShrunk).*D3, ...9
               grade5, ...10
               grade5.*log(Y_EimputeShrunk), ...11
               grade5.*log(Y_LimputeShrunk), ... 12
               fem, ...13
               fem.*log(Y_EimputeShrunk), ...14
               fem.*log(Y_LimputeShrunk), ...15
               blk, ... 16
               hsp, ... 17
               log(Y_EimputeShrunk).*blk, ... 18
               log(Y_EimputeShrunk).*hsp, ... 19
               log(Y_LimputeShrunk).*blk, ... 20
               log(Y_LimputeShrunk).*hsp, ...21
               SSEInc, ... 22
               SSEIns, ... 23
               log(Y_EimputeShrunk).*SSEInc, ... 24
               log(Y_EimputeShrunk).*SSEIns, ... 25
               log(Y_LimputeShrunk).*SSEInc, ... 26
               log(Y_LimputeShrunk).*SSEIns, ... 27 
               NHelpers, ... 28 
               log(Y_EimputeShrunk).*NHelpers, ... 29
               log(Y_LimputeShrunk).*NHelpers, ... 30
               InvPar, ... 31
               BigFam, ... 32
               Middle, ... 33
               Youngest, ... 34
               log(Y_EimputeShrunk).*InvPar, ... 35
               log(Y_EimputeShrunk).*BigFam, ... 36
               log(Y_EimputeShrunk).*Middle, ... 37
               log(Y_EimputeShrunk).*Youngest, ... 38
               log(Y_LimputeShrunk).*InvPar, ... 39
               log(Y_LimputeShrunk).*BigFam, ... 40
               log(Y_LimputeShrunk).*Middle, ... 41
               log(Y_LimputeShrunk).*Youngest, ... 42
               NoHmIntrnt, ... 43
               log(Y_EimputeShrunk).*NoHmIntrnt, ... 44
               log(Y_LimputeShrunk).*NoHmIntrnt, ... 45
               MoblFrac, ... 46
               log(Y_EimputeShrunk).*MoblFrac, ... 47
               log(Y_LimputeShrunk).*MoblFrac, ... 48
               TabltFrac, ... 49
               log(Y_EimputeShrunk).*TabltFrac, ... 50
               log(Y_LimputeShrunk).*TabltFrac] ; % 51


%%%%Test for joint significance of all the SSEInc & SSEIns terms
R = zeros(9,length(ExpVars_LR5(1,:))) ; for ii=1:9; R(ii,21+ii) = 1 ; end; r = zeros(9,1) ;
[alpha_LR5,se_LR5,tstat_LR5,pval_LR5,CI_LR5,out_LR5] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]);  
alphaE_LR5  = alpha_LR5(2)*ones(length(logPreScore),1) + D2*alpha_LR5(6) + D3*alpha_LR5(7) + grade5*alpha_LR5(11) ...
              + fem*alpha_LR5(14) + blk*alpha_LR5(18) + hsp*alpha_LR5(19) + SSEInc*alpha_LR5(24) + SSEIns*alpha_LR5(25) ...
              + NHelpers*alpha_LR5(29) + InvPar*alpha_LR5(35) + BigFam*alpha_LR5(36) + Middle*alpha_LR5(37) + Youngest*alpha_LR5(38) ...
              + NoHmIntrnt*alpha_LR5(44) + MoblFrac*alpha_LR5(47) + TabltFrac*alpha_LR5(50) ;
alphaL_LR5  = alpha_LR5(3)*ones(length(logPreScore),1) + D2*alpha_LR5(8) + D3*alpha_LR5(9) + grade5*alpha_LR5(12) ...
              + fem*alpha_LR5(15) + blk*alpha_LR5(20) + hsp*alpha_LR5(21) + SSEInc*alpha_LR5(26) + SSEIns*alpha_LR5(27) ...
              + NHelpers*alpha_LR5(30) + InvPar*alpha_LR5(39) + BigFam*alpha_LR5(40) + Middle*alpha_LR5(41) + Youngest*alpha_LR5(42) ...
              + NoHmIntrnt*alpha_LR5(45) + MoblFrac*alpha_LR5(48) + TabltFrac*alpha_LR5(51) ;  
TFP_LR5     = exp( alpha_LR5(1)*ones(length(logPreScore),1) + D2*alpha_LR5(4) + D3*alpha_LR5(5) + grade5*alpha_LR5(10) ...
              + fem*alpha_LR5(13) + blk*alpha_LR5(16) + hsp*alpha_LR5(17) + SSEInc*alpha_LR5(22) + SSEIns*alpha_LR5(23) ...
              + NHelpers*alpha_LR5(28) + InvPar*alpha_LR5(31) + BigFam*alpha_LR5(32) + Middle*alpha_LR5(33) + Youngest*alpha_LR5(34) ...
              + NoHmIntrnt*alpha_LR5(43) + MoblFrac*alpha_LR5(46) + TabltFrac*alpha_LR5(49) ) ; 
StDevEffectATE = nan(length(alpha_LR5)+2,1) ;  
StDevEffectATE(1)  = std( log(TFP_LR5) )/StDevlogPre ; %%%%This represents a one standard deviation change in the log(TFP) factor, which varies across individuals
StDevEffectATE(2)  = mean( std(log(Y_EimputeShrunk))*alphaE_LR5 )/StDevlogPre ;  %%%%This is a one standard deviation increase in log(thetaE)
StDevEffectATE(3)  = mean( std(log(Y_LimputeShrunk))*alphaL_LR5 )/StDevlogPre ;  %%%%This is a one standard deviation increase in log(thetaL)
StDevEffectATE(4)  = mean( ( alpha_LR5(4) + log(Y_EimputeShrunk)*alpha_LR5(6) + log(Y_LimputeShrunk)*alpha_LR5(8) )/StDevlogPre ) ;  %%%%This is a change from District 1 to District 2
StDevEffectATE(5)  = mean( ( alpha_LR5(5) + log(Y_EimputeShrunk)*alpha_LR5(7) + log(Y_LimputeShrunk)*alpha_LR5(9) )/StDevlogPre ) ;  %%%%This is a change from District 1 to District 3
StDevEffectATE(10) = mean( ( alpha_LR5(10) + log(Y_EimputeShrunk)*alpha_LR5(11) + log(Y_LimputeShrunk)*alpha_LR5(12) )/StDevlogPre ) ;  %%%%This is a change from grade 6 to grade 5
StDevEffectATE(13) = mean( ( alpha_LR5(13) + log(Y_EimputeShrunk)*alpha_LR5(14) + log(Y_LimputeShrunk)*alpha_LR5(15) )/StDevlogPre ) ;  %%%%This is a change from male to female
StDevEffectATE(16) = mean( ( alpha_LR5(16) + log(Y_EimputeShrunk)*alpha_LR5(18) + log(Y_LimputeShrunk)*alpha_LR5(20) )/StDevlogPre ) ;  %%%%This is a change from WAO to BLACK
StDevEffectATE(17) = mean( ( alpha_LR5(17) + log(Y_EimputeShrunk)*alpha_LR5(19) + log(Y_LimputeShrunk)*alpha_LR5(21) )/StDevlogPre ) ;  %%%%This is a change from WAO to HISPANIC
StDevEffectATE(22) = mean( std(SSEInc)*( alpha_LR5(22) + log(Y_EimputeShrunk)*alpha_LR5(24) + log(Y_LimputeShrunk)*alpha_LR5(26) )/StDevlogPre ) ;  %%%%This is a standard deviation increase in SSEInc
StDevEffectATE(23) = mean( std(SSEIns)*( alpha_LR5(23) + log(Y_EimputeShrunk)*alpha_LR5(25) + log(Y_LimputeShrunk)*alpha_LR5(27) )/StDevlogPre ) ;  %%%%This is a standard deviation increase in SSEIns
StDevEffectATE(28) = mean( std(NHelpers)*( alpha_LR5(28) + log(Y_EimputeShrunk)*alpha_LR5(29) + log(Y_LimputeShrunk)*alpha_LR5(30) )/StDevlogPre ) ;  %%%%This is a standard deviation increase in SSEInc
StDevEffectAToT = nan(length(alpha_LR5)+2,1) ;
StDevEffectAToT(4)  = mean( ( alpha_LR5(4) + log(Y_EimputeShrunk(D2==1))*alpha_LR5(6) + log(Y_LimputeShrunk(D2==1))*alpha_LR5(8) )/StDevlogPre ) ;  %%%%This is a change from District 1 to District 2
StDevEffectAToT(5)  = mean( ( alpha_LR5(5) + log(Y_EimputeShrunk(D3==1))*alpha_LR5(7) + log(Y_LimputeShrunk(D3==1))*alpha_LR5(9) )/StDevlogPre ) ;  %%%%This is a change from District 1 to District 3
StDevEffectAToT(10) = mean( ( alpha_LR5(10) + log(Y_EimputeShrunk(grade5==1))*alpha_LR5(11) + log(Y_LimputeShrunk(grade5==1))*alpha_LR5(12) )/StDevlogPre ) ;  %%%%This is a change from grade 6 to grade 5
StDevEffectAToT(13) = mean( ( alpha_LR5(13) + log(Y_EimputeShrunk(fem==1))*alpha_LR5(14) + log(Y_LimputeShrunk(fem==1))*alpha_LR5(15) )/StDevlogPre ) ;  %%%%This is a change from male to female
StDevEffectAToT(16) = mean( ( alpha_LR5(16) + log(Y_EimputeShrunk(blk==1))*alpha_LR5(18) + log(Y_LimputeShrunk(blk==1))*alpha_LR5(20) )/StDevlogPre ) ;  %%%%This is a change from WAO to BLACK
StDevEffectAToT(17) = mean( ( alpha_LR5(17) + log(Y_EimputeShrunk(hsp==1))*alpha_LR5(19) + log(Y_LimputeShrunk(hsp==1))*alpha_LR5(21) )/StDevlogPre ) ;  %%%%This is a change from WAO to HISPANIC
disp('-----------------------------------------------------------------------------------')
disp('-------------------  INITIAL PROFICIENCY PRODUCTION: MODEL 5    -------------------')
disp('-----------------------------------------------------------------------------------')
out_LR5.results.StDevEffectATE = StDevEffectATE;
out_LR5.results.StDevEffectAToT = StDevEffectAToT;
WhiteTest  = out_LR5.White %#ok
Method     = out_LR5.method %#ok
disp(out_LR5.results(:,:)) 
components = {'log(TFP)';'alphaE';'alphaL'}; Mean = [mean(log(TFP_LR5)); mean(alphaE_LR5); mean(alphaL_LR5)]; StDev = [std(log(TFP_LR5)); std(alphaE_LR5); std(alphaL_LR5)] ; 
MeanStDevAcrossi = table(components,Mean,StDev)  %#ok
%%%%Test for joint significance of TFP:
R = zeros(17,length(ExpVars_LR5(1,:))) ; R(1,1)=1; R(2,4)=1; R(3,5)=1; R(4,10)=1; R(5,13)=1; R(6,16)=1; R(7,17)=1; ...
                                         R(8,22)=1; R(9,23)=1; R(10,28)=1; R(11,31)=1; R(12,32)=1; R(13,33)=1; R(14,34)=1; ...
                                         R(15,43)=1; R(16,46)=1; R(17,49)=1; r = zeros(17,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
TFPtest          = temp.Wald %#ok
%%%%Test for joint significance of alphaE terms:
R = zeros(17,length(ExpVars_LR5(1,:))) ; R(1,2)=1; R(2,6)=1; R(3,7)=1; R(4,11)=1; R(5,14)=1; R(6,18)=1; R(7,19)=1; R(8,24)=1; R(9,25)=1; ...
                                         R(10,29)=1; R(11,35)=1; R(12,36)=1; R(13,37)=1; R(14,38)=1; R(15,44)=1; R(16,47)=1; R(17,50)=1; r = zeros(17,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
logEtest   = temp.Wald %#ok
%%%%Test for joint significance of alphaL terms:
R = zeros(17,length(ExpVars_LR5(1,:))) ; R(1,3)=1; R(2,8)=1; R(3,9)=1; R(4,12)=1; R(5,15)=1; R(6,20)=1; R(7,21)=1; R(8,26)=1; R(9,27)=1; ...
                                         R(10,30)=1; R(11,39)=1; R(12,40)=1; R(13,41)=1; R(14,42)=1; R(15,45)=1; R(16,48)=1; R(17,51)=1; r = zeros(17,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
logLtest   = temp.Wald %#ok
%%%%Test for joint significance of D2 terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,4)=1; R(2,6)=1; R(3,8)=1; r = zeros(3,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
D2test   = temp.Wald %#ok
%%%%Test for joint significance of D2 SLOPE terms:
R = zeros(2,length(ExpVars_LR5(1,:))) ; R(1,6)=1; R(2,8)=1; r = zeros(2,1) ; 
[~,~,~,~,~,temp]  = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
D2Slopetest = temp.Wald %#ok
%%%%Test for joint significance of D3 terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,5)=1; R(2,7)=1; R(3,9)=1; r = zeros(3,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
D3test   = temp.Wald %#ok
%%%%Test for joint significance of D3 SLOPE terms:
R = zeros(2,length(ExpVars_LR5(1,:))) ; R(1,7)=1; R(2,9)=1; r = zeros(2,1) ; 
[~,~,~,~,~,temp]  = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
D3Slopetest = temp.Wald %#ok
%%%%Test for joint significance of ALL D2&D3 terms:
R = zeros(6,length(ExpVars_LR5(1,:))) ; for ii=1:6; R(ii,3+ii)=1; end; r = zeros(6,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
D23test   = temp.Wald %#ok
%%%%Test for joint significance of ALL District SLOPE terms:
R = zeros(4,length(ExpVars_LR5(1,:))) ; R(1,6)=1; R(2,7)=1; R(3,8)=1; R(4,9)=1; r = zeros(4,1) ; 
[~,~,~,~,~,temp]  = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
D23Slopetest = temp.Wald %#ok
%%%%Test for joint significance of All District TFP terms:
R = zeros(2,length(ExpVars_LR5(1,:))) ; R(1,4)=1; R(2,5)=1; r = zeros(2,1) ; 
[~,~,~,~,~,temp]  = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
D23TFPtest = temp.Wald %#ok
%%%%Test for joint significance of grade5 terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,10)=1; R(2,11)=1; R(3,12)=1; r = zeros(3,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
grade5test   = temp.Wald %#ok
%%%%Test for joint significance of grade5 interaction terms:
R = zeros(2,length(ExpVars_LR5(1,:))) ; R(1,11)=1; R(2,12)=1; r = zeros(2,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
grade5Interactiontest   = temp.Wald %#ok
%%%%Test for joint significance of gender terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,13)=1; R(2,14)=1; R(3,15)=1; r = zeros(3,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
femtest   = temp.Wald %#ok
%%%%Test for joint significance of gender interaction terms:
R = zeros(2,length(ExpVars_LR5(1,:))) ; R(1,14)=1; R(2,15)=1; r = zeros(2,1) ; 
[~,~,~,~,~,temp]   = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
femInteractiontest = temp.Wald %#ok
%%%%Test for joint significance of blk terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,16)=1; R(2,18)=1; R(3,20)=1; r = zeros(3,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
blktest   = temp.Wald %#ok
%%%%Test for joint significance of blk interaction terms:
R = zeros(2,length(ExpVars_LR5(1,:))) ; R(1,18)=1; R(2,20)=1; r = zeros(2,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
blkInteractiontest   = temp.Wald %#ok
%%%%Test for joint significance of hsp terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,17)=1; R(2,19)=1; R(3,21)=1; r = zeros(3,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
hsptest   = temp.Wald %#ok
%%%%Test for joint significance of hsp interaction terms:
R = zeros(2,length(ExpVars_LR5(1,:))) ; R(1,19)=1; R(2,21)=1; r = zeros(2,1) ; 
[~,~,~,~,~,temp]   = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
hspInteractiontest = temp.Wald %#ok
%%%%Test for joint significance of SSEInc terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,22)=1; R(2,24)=1; R(3,26)=1; r = zeros(3,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
SSEInctest   = temp.Wald %#ok
%%%%Test for joint significance of SSEIns terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,23)=1; R(2,25)=1; R(3,27)=1; r = zeros(3,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
SSEInstest   = temp.Wald %#ok
%%%%Test for joint significance of ALL SSE terms:
R = zeros(6,length(ExpVars_LR5(1,:))) ; for ii=1:6; R(ii,21+ii)=1; end; r = zeros(6,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
SSEtest   = temp.Wald %#ok
%%%%Test for joint significance of NHelppeer terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,28)=1; R(2,29)=1; R(3,30)=1; r = zeros(3,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
NHelperstest   = temp.Wald %#ok

%%%%Test for joint significance of Parent Survey terms:
R = zeros(3,length(ExpVars_LR5(1,:))) ; R(1,31)=1; R(2,32)=1; R(3,33)=1; R(4,34)=1; R(5,35)=1; R(6,36)=1; R(7,37)=1; R(8,38)=1; R(9,39)=1; R(10,40)=1; R(11,41)=1; R(12,42)=1; r = zeros(12,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
ParSurveytest   = temp.Wald %#ok
R = zeros(9,length(ExpVars_LR5(1,:))) ; for ii=1:9; R(ii,42+ii)=1; end; r = zeros(9,1) ; 
[~,~,~,~,~,temp] = regressHet(logPreScore,ExpVars_LR5,'FGLSrobust',labels_LR5,R,r,0,[],[],[]); 
HomeConnectivitytest   = temp.Wald %#ok




pre = pretemp ;


